package com.itheima.fanxing;

import java.util.ArrayList;
import java.util.Arrays;

/*
泛型方法的使用
 */
public class Demo04 {

    public static void main(String[] args) {
        ArrayList<String> list = new ArrayList<>();
        list.add("吴亦凡1");
        list.add("吴亦凡2");
        list.add("吴亦凡3");
        list.add("吴亦凡4");
        Object[] objects = list.toArray();
        for (Object object : objects) {
            String s= (String) object;
            System.out.println(s.length());
        }
        String[] strs=new String[list.size()];
        String[] strings = list.toArray(strs);
        for (String str : strings) {
            System.out.println(str.length());
        }

    }
}
